import { baseUrlApi, requestClient, type Result } from '#/api/request';





/** 幻灯片列表 */
export const getSlides = (params?: { type?: number }) => {
  return requestClient.get<Result>(baseUrlApi('/admin/slides'), {
    params, // 自动转换为 query 参数，如 ?type=1
  });
};

/**
 * 添加幻灯片
 * @param data
 * @returns
 */
export const postSlides = (data?: object) => {
  return requestClient.post<Result>(baseUrlApi('/admin/slides'), data);
};

/**
 * 获取幻灯片信息
 * @param id
 * @returns
 */
export const getSlidesInfo = (id: number) => {
  return requestClient.get<Result>(baseUrlApi(`/admin/slides/${id}`));
};

/**
 * 编辑幻灯片
 * @param id
 * @param data
 * @returns
 */
export const putSlides = (data?: any) => {
  return requestClient.put<Result>(
    baseUrlApi(`/admin/slides/${data.id}`),
    data,
  );
};

/**
 * 删除幻灯片
 * @param id
 * @returns
 */
export const deleteSlides = (id: number) => {
  return requestClient.delete<Result>(baseUrlApi(`/admin/slides/${id}`));
};
